﻿Public Class MainForm
    Implements ContainerInterface

    Dim oParamTest As String
    Public oList As New List(Of Control)


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowHideMenu.Click
        Splitter.Panel1Collapsed = Not Splitter.Panel1Collapsed

        If ShowHideMenu.Text = "▲" Then
            ShowHideMenu.Text = "▼"
        Else
            ShowHideMenu.Text = "▲"
        End If
    End Sub


    Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim oLogin As New Login

        oLogin.ShowDialog()

        tcMain.ShowCloseButtonOnTabs = True

    End Sub

    Private Sub btnParam_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnParam.Click
        Dim oPara As New Param
        Dim oInteret As New GestionInterets
        Dim oFormation As New GestionFormation
        Dim oTypeEmp As New GestionTypeEmploye
        Dim oTypeBene As New GestionTypeBene
        Dim oPoste As New GestionPoste

        oPara.Initialize()
        'myTableLayout.Controls.Add(oPara)

        AddTabToTC("Paramètres", True, oPara, oInteret, oFormation, oTypeEmp, oTypeBene, oPoste)


    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHoraire.Click
        Dim oHoraire As New HoraireOverview
        AddTabToTC("Gestion des horaires", True, oHoraire)


    End Sub

    Public Sub AddTabToTC(ByVal strNomTab As String, ByVal Fill As Boolean, ByVal ParamArray oControl() As Control)

        If tcMain.CanAddNewTab(strNomTab) Then
            tcMain.AddNewTab(strNomTab, Fill, oControl)
        Else
            tcMain.SelectTabByName(strNomTab)
        End If
    End Sub

    Private Sub btnBeneficiaire_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBeneficiaire.Click

        Dim oBeneList As New ListeBeneficiaire

        AddTabToTC("Liste des Bénéficiaires", True, oBeneList)


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmploye.Click
        Dim oEmpList As New ListeEmployes
        AddTabToTC("Liste des employés", True, oEmpList)
    End Sub


    Public Sub AddErrorToLocalErrorProvider(ByRef oControl As System.Windows.Forms.Control, ByVal strMessage As String, Optional ByVal DispatchToActivityBox As Boolean = True) Implements ContainerInterface.AddErrorToLocalErrorProvider
        LocalErrorProvider.SetError(oControl, strMessage)
        If DispatchToActivityBox Then
            Outils.ErrorProviderFunctions.DispatchToActivityBox(Outils.ErrorProviderFunctions.ErrorType.Critical, strMessage, oControl)
        End If

    End Sub

    Public Sub RemoveErrorToLocalErrorProvider(ByRef oControl As System.Windows.Forms.Control) Implements ContainerInterface.RemoveErrorToLocalErrorProvider
        LocalErrorProvider.SetError(oControl, Nothing)
    End Sub


End Class